<?php
	require_once('../includes/user.php');
	$user=new User(); 
	$cnt=1;
?>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td align="center" valign="middle" class="head">Rank</td>
    <td align="center" valign="middle" class="head">Student Name</td>
    <td align="center" valign="middle" class="head">Reg No</td>
    <td align="center" valign="middle" class="head">Year</td>
    <td align="center" valign="middle" class="head">Marks</td>
  </tr>
  <tr>
    <td width="3%" align="center" valign="middle" class="head">&nbsp;</td>
    <td width="27%" align="center" valign="middle" class="head">&nbsp;</td>
    <td width="22%" align="center" valign="middle" class="head">&nbsp;</td>
    <td width="26%" align="center" valign="middle" class="head">&nbsp;</td>
    <td width="22%" align="center" valign="middle" class="head">&nbsp;</td>
  </tr>
  <?php
	$ques_res=$user->query("select * from quiz_history where quiz_id='$_POST[test_id]' ORDER BY result desc");
	while($ques_row=mysql_fetch_array($ques_res))
	{
		$p_row=$user->getUserProfile($ques_row['profile_id']);
?>
  <tr>
    <td align="center" valign="middle"><?php echo $cnt; ?></td>
    <td align="center" valign="middle"><?php echo $p_row['name']; ?></td>
    <td align="center" valign="middle"><?php echo $p_row['regno']; ?></td>
    <td align="center" valign="middle"><?php echo $user->getYear($p_row['year']); ?></td>
    <td align="center" valign="middle"><?php echo $ques_row['result']; ?></td>
  </tr>
  <tr>
    <td align="center" valign="middle">&nbsp;</td>
    <td align="center" valign="middle">&nbsp;</td>
    <td align="center" valign="middle">&nbsp;</td>
    <td align="center" valign="middle">&nbsp;</td>
    <td align="center" valign="middle">&nbsp;</td>
  </tr>
<?php
	$cnt++;
	}
?>
</table>
